package com.dream.wukong.configcenter.client.core;

import com.google.common.collect.Maps;

import java.util.Map;

/** 
* 描  述: 初始化配置
* 创建时间: 2018/5/22 
*/
public class InitConfig {

    private  String serviceName = System.getenv("SERVICE_NAME");
    private  String configIp = System.getenv("CONFIG_IP");
    private  String configPort = System.getenv("CONFIG_PORT");
    private  int initialDelayMillis = 60000;
    private  int delayMillis = 60000;
    private  boolean ignoreDeletesFromSource = false;
    private Map<String,Object> attach = Maps.newHashMap();


    public static InitConfig getInstance(){
        return InitConfigHolder.INSTANCE;
    }
    protected Object readResolve() {
        return InitConfigHolder.INSTANCE;
    }


    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getConfigIp() {
        return configIp;
    }

    public void setConfigIp(String configIp) {
        this.configIp = configIp;
    }

    public String getConfigPort() {
        return configPort;
    }

    public void setConfigPort(String configPort) {
        this.configPort = configPort;
    }

    public int getInitialDelayMillis() {
        return initialDelayMillis;
    }

    public void setInitialDelayMillis(int initialDelayMillis) {
        this.initialDelayMillis = initialDelayMillis;
    }

    public int getDelayMillis() {
        return delayMillis;
    }

    public void setDelayMillis(int delayMillis) {
        this.delayMillis = delayMillis;
    }

    public boolean isIgnoreDeletesFromSource() {
        return ignoreDeletesFromSource;
    }

    public void setIgnoreDeletesFromSource(boolean ignoreDeletesFromSource) {
        this.ignoreDeletesFromSource = ignoreDeletesFromSource;
    }

    public Map<String, Object> getAttach() {
        return attach;
    }

    public void setAttach(Map<String, Object> attach) {
        this.attach = attach;
    }

    public void put(String paramKey , Object paramValue){
        attach.put(paramKey,paramValue);
    }

    private static final class InitConfigHolder {
        private static final InitConfig INSTANCE = new InitConfig();
    }
}
